# Contributor: Díaz Urbaneja Diego <sodomon2@gmail.com>
# Maintainer: Díaz Urbaneja Diego <sodomon2@gmail.com>
pkgname=trantor
pkgver=1.5.18
pkgrel=0
pkgdesc="A non-blocking I/O tcp network lib based on c++14/17."
url="https://github.com/an-tao/trantor"
arch="all"
license="BSD-3-Clause"
makedepends="
	cmake
	c-ares-dev
	doxygen
	openssl-dev
	samurai
	"
subpackages="$pkgname-dev $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/an-tao/trantor/archive/v$pkgver.tar.gz"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		local crossopts="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=ON \
		-DCMAKE_BUILD_TYPE=Release \
		$crossopts
	cmake --build build
}

check() {
	ctest --test-dir build --output-on-failure
}

package() {
	install -Dm644 License "$pkgdir/usr/share/licenses/$pkgname/License"
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
2dba27efad95155a76968959d9bd2510be8502b9424716493f385aebbce2481553cc8fae283076029aed4bef6f0aadb0bec3f9acb98fbca3ef4d49b936558f8c  trantor-1.5.18.tar.gz
"
